{{if false}}<script>{{/if}}
    {{$controller = $smarty.const.CCTRL}}
    {{$token = $smarty.const.TOKEN}}
    {{include file="../00_base/_function.tpl"}}
        function handleEvents(){
            try{
                acolumns['_id'].cellsrenderer = function (row, column, value) {
                    return "<span class='a lh24 pl8' title='"+value+"'>" + value.substring(0, 10).toUpperCase() + "</span>";
                }
                acolumns['_value'].validation= function (cell, value) {
                    if (value < 0 || value > 100) {
                        return { result: false, message: "Position should be in the 0-100 interval" };
                    }
                    return true;
                };
                acolumns['_value'].createeditor=function (row, cellvalue, editor) {
                    editor.jqxNumberInput({ decimalDigits: 0 });
                };
            }catch(e){tipMessage(e.message);}
        }
        function SaveItem(){
            try{
                if(isrunning)return;
                console.log("Save ↵ Call");
                var _id,_name,_alias,_value,_des;                                
                _id = $('#_id').val();
                _name = $('#_name').val();
                _alias = $('#_alias').val();
                _value = $('#_value').val();
                _des = $('#_description').val();//areaContent.instanceById('txtContent').getContent();//
                var url="{{base_url()}}backend/{{$controller}}/save";
                var data={
                    _id             :   _id,
                    _name           :   _name,
                    _alias          :   _alias,
                    _value          :   _value,
                    _des            :   _des
                }
                //ShowNoticeDialogMessage($("<div />").text(Content).html());return;
                console.log(data);
                isrunning=true;
                myAjax(url,data,function(data){
                    isrunning=false;
                    if(data.result>=0){
                        uiMessage(data.message)
                        myjqxGrid.CancelEdit();
                        myjqxGrid.Refresh();
                    }else{
                        ShowErrorDialogMessage(data.message);
                    }
                });
            }catch(e){
                console.log("JSON Error:"+e.message+"\n↵ Error");
                ShowErrorDialogMessage(e.message);
                //ShowErrorDialogMessage("Sorry. Your request could not be completed.<br/> Please check your input data.");
            }
        }